package base.day24;

import java.io.*;

public class MyCharacterStream12 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        Student stu1=new Student("张三",19);
        Student stu2=new Student("李四",19);
        Student stu3=new Student("王五",19);
        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("E:\\java\\java project\\java-code\\a.txt"));
        oos.writeObject(stu1);
        oos.writeObject(stu2);
        oos.writeObject(stu3);
        oos.close();

        ObjectInputStream ois=new ObjectInputStream(new FileInputStream("E:\\java\\java project\\java-code\\a.txt"));
        while (true){
            try {
                Object o = ois.readObject();
                System.out.println(o);
            } catch (EOFException e) {
                break;
            }
        }


    }
}
